How can I use `SetEnvIf` to clear an Apache2 environment variable?

Posted by Jamie on Server Fault See other posts from Server Fault or by Jamie
Published on 2013-10-25T15:40:30Z Indexed on 2013/10/25 15:56 UTC
Read the original article Hit count: 323

Filed under:
|
|

In my apache2 configuration I've got these lines:

    SetEnv log_everything
    # Create the environment variables based on access requests
    SetEnvIf Request_URI "^/orders/.*$"     download_access !log_everything
    SetEnvIf Request_URI "^/download/.*$"   download_access !log_everything
    SetEnvIf Request_URI "^/wg/.*$"         wg_1x1_access !log_everything

    # Log the accesses using the generated environment variable as conditionals.
    CustomLog ${APACHE_LOG_DIR}/download.log        combined  env=download_access
    CustomLog ${APACHE_LOG_DIR}/wg.log      combined  env=wg_1x1_access

    RewriteEngine on
    RewriteRule "^/wg/.+$" "/wg/1x1.gif"

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined env=log_everything

Which currently logs all the "download" and "orders" requests to "download.log" and "wg" requests to "wg.log", but everything is also going to access.log.

How can I configure this so that "wg" and "download/orders" requests won't be duplicated in access.log?

© Server Fault or respective owner

Related posts about apache2

Related posts about logging